import i18n from '@I18N'
import { CONSULTATION_TYPE } from '@CONSTANTS/common'
import { getTelOrderList, getPicOrderList } from '@SAGAS/dataSelect'
import { StringMapITF } from '@INTERFACES/Common'
import { PlanIconITF, ServicePackCardColorITF } from '@INTERFACES/Order'
import { PACK_STATUS_ENUM } from '@CONSTANTS/servicePack'
import { PAIN_MANAGEMENT_STATUS_ENUM } from '@CONSTANTS/planManagement'
import Images from '@ASSET/Images'

export enum ORDER_STATUS {
  New = 'New',
  VendorPending = 'VendorPending',
  VendorCancelled = 'VendorCancelled',
  PatronCancelled = 'PatronCancelled',
  Processing = 'Processing',
  Closed = 'Closed',
  PaymentFailed = 'PaymentFailed',
}
export const ORDER_STATUS_TEXT = {
  New: '待支付',
  VendorPending: '待接诊',
  VendorCancelled: '已关闭',
  PatronCancelled: '已取消',
  Processing: '咨询中',
  Closed: '已完成',
}
export enum CANCEL_CLOSE_REASON {
  PaymentTimeout = 'PaymentTimeout',
  DoctorRejected = 'DoctorRejected',
  AcceptTimeout = 'AcceptTimeout',
  AdminCancel = 'AdminCancel',
  TimeDue = 'TimeDue',
  DoctorClose = 'DoctorClose'
}

export const CANCEL_CLOSE_REASON_TEXT: StringMapITF = {
  [CANCEL_CLOSE_REASON.PaymentTimeout]: i18n.order.payment_timeout(),
  [CANCEL_CLOSE_REASON.DoctorRejected]: i18n.order.vendor_cancelled(),
  [CANCEL_CLOSE_REASON.AcceptTimeout]: i18n.order.vendor_cancelled(),
  [CANCEL_CLOSE_REASON.AdminCancel]: i18n.order.vendor_cancelled(),
}
export const ORDER_DETAIL_STATUS_TITLE: StringMapITF = {
  New: '待支付',
  VendorPending: '医生接诊',
  VendorCancelled: '订单已取消',
  PatronCancelled: '订单已取消',
  Processing: '咨询中',
  Closed: '咨询完成'
}
export const ORDER_DETAIL_STATUS_DESC: StringMapITF = {
  VendorPending: i18n.order.vendor_pending(),
  PatronCancelled: i18n.order.patron_cancelled(),
  VendorCancelled: i18n.order.vendor_cancelled(),
  Processing: i18n.order.processing(),
  Closed: i18n.order.closed()
}
export const ORDER_DETAIL_BTN_TEXT: StringMapITF = {
  [ORDER_STATUS.PatronCancelled]: i18n.message.consultation_again(),
  [ORDER_STATUS.VendorCancelled]: i18n.message.consultation_again(),
  [ORDER_STATUS.Closed]: i18n.order.consultation_detail(),
}

export const ORDER_CARD_TYP = {
  DOCTOR: 'DOCTOR',
  CONTENT: 'CONTENT',
  ORDER_INFO: 'ORDER_INFO'
}

export const COMMENT_LEVELS = [{
  Name: 'ONE',
  DisplayName: {
    zh: '非常差',
    en: 'Very bad',
  }
}, {
  Name: 'TWO',
  DisplayName: {
    zh: '差',
    en: 'Bad',
  }
}, {
  Name: 'THREE',
  DisplayName: {
    zh: '一般',
    en: 'Common',
  }
}, {
  Name: 'FOUR',
  DisplayName: {
    zh: '满意',
    en: 'Good',
  }
}, {
  Name: 'FIVE',
  DisplayName: {
    zh: '非常满意',
    en: 'Very good',
  }
}]

export const FINISH_MINIS = 900000

export const ConsulStateMap = {
  [CONSULTATION_TYPE.PICTURE_TEXT]: {
    getPreList: getPicOrderList,
    initLoad: 'initLoadPicOrderList',
    loading: 'loadingPicOrderList',
    data: 'picOrderList',
    canLoad: 'canLoadPicOrderList',
  },
  [CONSULTATION_TYPE.PHONE]: {
    getPreList: getTelOrderList,
    initLoad: 'initLoadTelOrderList',
    loading: 'loadingTelOrderList',
    data: 'telOrderList',
    canLoad: 'canLoadTelOrderList',
  },
}

export const STATUS_COLOR_MAP = {
  [ORDER_STATUS.VendorPending]: '#CEA636',
  [ORDER_STATUS.VendorCancelled]: '#C2C2C2',
  [ORDER_STATUS.PatronCancelled]: '#C2C2C2',
  [ORDER_STATUS.Processing]: '#47C690',
  [ORDER_STATUS.Closed]: '#C2C2C2',
}

export const SERVICE_PACK_STATUS_COLOR_MAP: ServicePackCardColorITF = {
  [PACK_STATUS_ENUM.Pending]: { lineColor: '#FB694A', statusColor: '#595959', statusText: '待支付' },
  [ORDER_STATUS.New]: { lineColor: '#FB694A', statusColor: '#595959', statusText: '待支付' },
  [PACK_STATUS_ENUM.Paid]: { lineColor: '#47C690', statusColor: '#47C690', statusText: '服务中' },
  [PACK_STATUS_ENUM.Active]: { lineColor: '#47C690', statusColor: '#47C690', statusText: '服务中' },
  [PACK_STATUS_ENUM.Expired]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已结束' },
  [PAIN_MANAGEMENT_STATUS_ENUM.Archived]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已结束' },
  [PACK_STATUS_ENUM.Cancelled]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已取消' },
  [ORDER_STATUS.VendorCancelled]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已取消' },
  [ORDER_STATUS.PatronCancelled]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已取消' },
  [ORDER_STATUS.PaymentFailed]: { lineColor: '#D9D9D9', statusColor: '#C2C2C2', statusText: '已取消' },
}

export const SERVICE_PACK_ORDER_STATUS_TEXT: StringMapITF = {
  [PACK_STATUS_ENUM.Pending]: '待支付',
  [PACK_STATUS_ENUM.Paid]: '服务中',
  [PACK_STATUS_ENUM.Active]: '服务中',
  [PACK_STATUS_ENUM.Cancelled]: '已取消',
  [PACK_STATUS_ENUM.Archived]: '已结束',
  [PACK_STATUS_ENUM.Expired]: '已结束'
}

export const PAIN_MANAGEMENT_ORDER_STATUS_TEXT: StringMapITF = {
  [PAIN_MANAGEMENT_STATUS_ENUM.Pending]: '待支付',
  [PAIN_MANAGEMENT_STATUS_ENUM.Active]: '服务中',
  [PAIN_MANAGEMENT_STATUS_ENUM.Cancelled]: '已取消',
  [PAIN_MANAGEMENT_STATUS_ENUM.Archived]: '已结束',
  [PAIN_MANAGEMENT_STATUS_ENUM.Expired]: '已结束'
}

export enum ORDER_ITEM_TYPE_ENUMS {
  Consultation = 'Consultation',
  ServicePack = 'ServicePack',
  PainManagement = 'PainManagement',
}

export enum SHIPMENT_STATUS_ENUM {
  None= 'None',
  Shipped= 'Shipped',
  Signed= 'Signed',
}

export enum CHARGE_TYPE_ENUM {
  Free = 'Free',
  Pay = 'Pay',
}

export const SHIPMENT_STATUS_TEXT_ENUM : StringMapITF = {
  [SHIPMENT_STATUS_ENUM.None]: '待发货',
  [SHIPMENT_STATUS_ENUM.Shipped]: '已发货',
  [SHIPMENT_STATUS_ENUM.Signed]: '已签收'
}
export const SHIPMENT_STATUS_DES_TEXT_ENUM : StringMapITF = {
  [SHIPMENT_STATUS_ENUM.None]: '',
  [SHIPMENT_STATUS_ENUM.Shipped]: '您的快递已经发货了，正在快马加鞭向您狂奔而来了！请耐心等待～',
  [SHIPMENT_STATUS_ENUM.Signed]: '您的快递已经签收了，如有问题可以点击下方联系客服哦！'
}

export const PLAN_STATUS_ICON_MAP: PlanIconITF = {
  [SHIPMENT_STATUS_ENUM.None]: { iconOrder: Images.order.icon_order_address_none, iconList: Images.order.icon_logistics_none },
  [SHIPMENT_STATUS_ENUM.Shipped]: { iconOrder: Images.order.icon_order_address_shipper, iconList: Images.order.icon_logistics_shipped },
  [SHIPMENT_STATUS_ENUM.Signed]: { iconOrder: Images.order.icon_order_address_signed, iconList: Images.order.icon_logistics_signed },
}

export const ERR_MSG = ['医生已接诊', '订单已关闭', '订单关闭失败']
